- person = @service.person

- content_for :javascript do
  initialize_profile_view("#{person.username}");

- content_for :title_header do
  %h1
    %span.profile-title= PersonViewUtils.person_display_name(person, @service.community)

- if person.image.present?
  - content_for :meta_image, person.image.url(:medium)
  - content_for :meta_image_width, '288'
  - content_for :meta_image_height, '288'

.row
  .col-8

    .row.relative
      .people-image-mobile
        = huge_avatar_thumb(person)
      .profile-action-buttons-mobile
        = render "profile_action_buttons", service: @service

    .row.profile-about-me
      - if person.description && !person.description.blank?
        = markdown(person.description)
      - elsif current_user?(person)
        %a{href: person_settings_path(person)}
          .icon-with-text-container
            .ss-chat.icon-part
            .ss.text-part= t(".add_description")

    - if @service.community_person_custom_fields.any?
      -  @service.community_person_custom_fields.each do |custom_field|
        - custom_field_value = person.custom_field_value_for(custom_field)
        - if custom_field_value
          - if custom_field.required? || custom_field_value.display_value.to_s.present?
            .row
              .col-12
                %span.people-custom-fields-title
                  = "#{custom_field.name(I18n.locale)}:"
                - if custom_field.is_a?(CheckboxField)
                  = render 'people/custom_fields/checkbox', custom_field: custom_field,
                  custom_field_value: custom_field_value
                - elsif custom_field.is_a?(TextField)
                  - text_with_url_links do
                    = custom_field_value.display_value
                - else
                  %span.people-custom-fields-value
                    = custom_field_value.display_value

    .row
      %h2.people-header
        - if @service.listings.total_entries > 0
          - if current_user?(person) && params[:show_closed]
            = pluralize(@service.listings.total_entries, t(".listing"), t(".listings"))
          - else
            = pluralize(@service.listings.total_entries, t(".open_listing"), t(".open_listings"))
        - else
          - if current_user?(person) && params[:show_closed]
            = t(".no_listings")
          - else
            = t(".no_open_listings")
        %span.people-show-closed-link
          - if current_user?(person)
            = link_to t("people.profile_listings.manage_listings"), listings_person_settings_path(person.username)

    #profile-listings-list
      - limit = 6
      = render :partial => 'listings/profile_listings', :locals => {person: person, limit: limit, listings: @service.listings}

    - if @service.community.follow_in_use?
      = render :partial => "followed_people", :locals => { person: person, followed_people: @service.followed_people, limit: 6 }

    #people-testimonials.listing-main
      .row
        %h2.people-header
          - if @service.received_testimonials?
            = pluralize(@service.received_testimonials.size, t(".review"), t(".reviews"))
            = "(#{@service.feedback_positive_percentage.to_s}% #{t("people.show.positive")}, #{@service.received_positive_testimonials.size}/#{@service.received_testimonials.size})"
          - else
            = t(".no_reviews")
        - if @service.received_testimonials?
          #profile-testimonials-list
            = render :partial => "testimonials", :locals => {:received_testimonials => @service.received_testimonials, :limit => 3}

  .col-4
    .row
      .people-image
        = huge_avatar_thumb(person)

    .row
      .profile-action-buttons-desktop
        = render "profile_action_buttons", service: @service

- content_for :extra_javascript do
  :javascript
    window.ST.initializeFollowButtons();
